Option Public
Use "WebsiteLibrary"

Sub Initialize
	'--------------------------------------------------------
	' Initialize variables
	'--------------------------------------------------------
	Print "Content-Type:text/html"
	Print {<Body><Form>}	
	On Error Goto oops
	Dim urlStr As String
	Dim msg As String
	Dim doc As NotesDocument
	Set doc=s.DocumentContext
	
	'--------------------------------------------------------
	' Create record number if not assigned yet
	'--------------------------------------------------------
	If doc.RecordNo(0) = "" Then 
		Call AssignTrackingNumber(doc)
	End If
	
	'--------------------------------------------------------
	' Set the web browser message
	'--------------------------------------------------------	
	msg = {Document <font color="red">}+_
	Cstr(doc.RecordNo(0))+{</font> has been saved.  }
	doc.Form= "Asset"
	urlStr = doc.URLRedirectTo(0)
	
	'--------------------------------------------------------
	' Perform addition actions based on doc status
	'--------------------------------------------------------	
	Select Case doc.saveMode(0)
	Case "save"
		msg = msg + "<p>Thank you for your update."	
	Case "future use"
		msg = msg + "<p>Thank you for your submittal."
	Case Else
		msg = msg + "<p>Thank you."
	End Select
	
	'--------------------------------------------------------
	' Display the message in the web browser
	'--------------------------------------------------------	
	Call SaveWebOutput ( urlStr, msg )
	doc.SaveStatus = "No Errors"	
	Print "</Form></Body>"	
	Print "</HTML>"	
	Exit Sub
	
Oops:
	doc.SaveStatus = "Error " & Err() & ": " & Error()	
	Print "</Form></Body>"	
	Print "</HTML>"	
	Resume
End Sub

